package cn.hanyx.coder.core.concurrent.thread.demo02;

class ZhaoDong {
	public synchronized void say(WangJingLei wjl) {
		System.out.println("赵冬说：给我500亿美圆，就放了你那没用弟弟，跟你争夺财产。");
		wjl.get();
	}
	public synchronized void get() {
		System.out.println("赵冬得到了银子，放了人质，买房子去了。");
	}
}
class WangJingLei {
	public synchronized void say(ZhaoDong zd) {
		System.out.println("王惊雷：放了我弟弟，我就给你500亿美圆。");
		zd.get();
	}
	public synchronized void get() {
		System.out.println("王惊雷救出了没用的弟弟，增加了自己的财产分割者。");
	}
}
public class ThreadDemo01 implements Runnable {
	private ZhaoDong zd = new ZhaoDong() ; 
	private WangJingLei wjl = new WangJingLei() ; 
	public static void main(String[] args) throws Exception {
		new ThreadDemo01() ;
	}
	public ThreadDemo01() {
		new Thread(this).start() ;
		wjl.say(zd);
	}
	@Override
	public void run() {
		zd.say(wjl);
	}
}